package com.sneakxy.mybase4j.platform.beans;

import java.util.ArrayList;
import java.util.List;

import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;

import com.sneakxy.mybase4j.base.bean.BaseEntity;
import com.sneakxy.mybase4j.base.bean.TimeEntity;
import com.sneakxy.mybase4j.base.bean.ValidAdd;
import com.sneakxy.mybase4j.base.bean.ValidEdit;
import com.sneakxy.mybatis.commons.annotations.Column;
import com.sneakxy.mybatis.commons.annotations.Table;
import com.sneakxy.mybatis.commons.orm.generation.GeneratedValue;
import com.sneakxy.mybatis.commons.orm.generation.GenerationType;

/**
 * 
 * @author 潜行的青衣
 * @see
 */
@Table("t_mb4j_menu")
public class Menu extends BaseEntity<String> implements TimeEntity {

	private final static long serialVersionUID = -1L;
	
	public final static String MENU_TYPE_SYSTEM = "MENU-TYPE-SYSTEM";

	@Id
	@NotBlank(groups = {ValidEdit.class})
	@Size(max=32)
	@Column("id")
	@GeneratedValue(strategy = GenerationType.UUID)
	private String id;

	@NotBlank
	@Size(max=50)
	@Column("icon")
	private String icon;

	@Size(max=100)
	@Column("router")
	private String router;

	@NotBlank
	@Size(max=100)
	@Column("name")
	private String name;

	@Column("sort")
	private Integer sort;

	@Size(max=50)
	@Column("i18n")
	private String i18n;

	@NotBlank(groups = ValidAdd.class)
	@Size(max=32)
	@Column("type")
	private String type;

	@Column("createtime")
	private String createtime;

	@Column("updatetime")
	private String updatetime;

	@Transient
	private List<Menu> children = new ArrayList<Menu>();
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getRouter() {
		return router;
	}

	public void setRouter(String router) {
		this.router = router;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public String getI18n() {
		return i18n;
	}

	public void setI18n(String i18n) {
		this.i18n = i18n;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getCreatetime() {
		return createtime;
	}

	public void setCreatetime(String createtime) {
		this.createtime = createtime;
	}

	public String getUpdatetime() {
		return updatetime;
	}

	public void setUpdatetime(String updatetime) {
		this.updatetime = updatetime;
	}

	/**
	 * @return the children
	 */
	public List<Menu> getChildren() {
		return children;
	}

	/**
	 * @param children the children to set
	 */
	public void setChildren(List<Menu> children) {
		this.children = children;
	}

}
